import request from '@/utils/request'

export default {
  // 讲师列表查询
  getTeacherList(currentPage, size, teacherQuerey) {
    return request({
      url: `/eduService/teacher/pageListTeacherCondition/${currentPage}/${size}`,
      method: 'post',
      // 因为后端是用RequestBody,获取数据，所以传参时需要按照data:teacherQuerey把对象转成json进行传递
      data: teacherQuerey
    })
  },

  // 根据id删除讲师
  removeTeacherById(id) {
    return request({
      url: `/eduService/teacher/removeTeacher/${id}`,
      method: 'delete'
    })
  },

  // 添加讲师
  addTeacher(teacher) {
    return request({
      url: `/eduService/teacher/addTeacher`,
      method: 'post',
      data: teacher
    })
  },

  // 根据id查找讲师
  getTeacherById(id) {
    return request({
      url: `/eduService/teacher/getTeacherById/${id}`,
      method: 'get'
    })
  },

  // 修改讲师
  updateTeacher(teacher) {
    return request({
      url: `/eduService/teacher/updateTeacher`,
      method: 'post',
      data: teacher
    })
  },

  // 查询所有讲师
  getAllTeachers() {
    return request({
      url: `/eduService/teacher/findAll`,
      method: 'get'
    })
  }
}
